<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <script>
        function Hero(name, blood, weapon) {
            this.name = name;
            this.blood = blood;
            this.weapon = weapon;

            this.attack = function() {
                console.log("使用[", this.weapon, "]攻击敌人")
            }
        }
        var hero1 = new Hero("刘备", 100, "剑")
        hero1.attack()
        console.log("typeof hero1 : ", typeof hero1)
        console.log("=== hero1.constructor ===")
        console.log(hero1.constructor)
        console.log("hero1.constructor === Hero : ", hero1.constructor === Hero)
        console.log("hero1 instanceof Hero : ", hero1 instanceof Hero)

        var arr = []; //new Array();
        console.log("typeof arr: ", typeof arr)
        console.log("=== arr.constructor ===")
        console.log(arr.constructor)

    </script>
</body>
</html>